package sspersonserver;

import sspersonserver.clientprocessors.ClientProcessor;
import sspersonserver.clientprocessors.MultiClientProcessor;
import sspersonserver.db.DatabaseHandler;
import sspersonserver.protocol.Protocol;

/**
 * Created by IntelliJ IDEA.
 * User: Double
 * Date: 25.01.12
 * Time: 15:47
 * To change this template use File | Settings | File Templates.
 */
public class Server
{
	private static ClientProcessor clientProcessor;
	private static MultiClientProcessor multiClientProcessor = new MultiClientProcessor();
	private static Protocol protocol = new Protocol();

	public static DatabaseHandler getDbHandler()
	{
		return dbHandler;
	}

	public static void setDbHandler(DatabaseHandler dbHandler)
	{
		Server.dbHandler = dbHandler;
	}

	private static DatabaseHandler dbHandler = new DatabaseHandler();

	public static Protocol getProtocol()
	{
		return protocol;
	}

	public static void setProtocol(Protocol protocol)
	{
		Server.protocol = protocol;
	}

	public static ClientProcessor getClientProcessor()
	{
		return clientProcessor;
	}
	public static void setClientProcessor(ClientProcessor cP)
	{
		clientProcessor = cP;
	}

	public static void main(String[] args)
	{
		clientProcessor = multiClientProcessor;
		new Thread(ConnectionServer.getInstance()).start();
		new Thread(multiClientProcessor).start();
		multiClientProcessor.initListeners();
		dbHandler.setDB("MySQL");
	}

}
